const Koa = require('koa');
const mysql = require('mysql');
const co = require('co-mysql');

const con = mysql.createPool({
    host: 'localhost',
    user: 'root',
    password: '19911020wcp',
    database: 'test'
})
let db = co(con);
let server = new Koa();
server.context.db = db;
server.listen(8888);
server.use(async ctx => {
    let data = await ctx.db.query('select * from usertest');
    console.log(data);
    ctx.body = data;
})
